from _load import ANTHROPIC_API_KEY, OPENAI_API_KEY, SPECK_API_KEY, FIREWORKS_API_KEY
from speck import OpenAI

openai = OpenAI(
    api_key=FIREWORKS_API_KEY,
    speck_api_key=SPECK_API_KEY,
    base_url = "https://api.fireworks.ai/inference/v1",
)

prompt = openai.prompt.read_prompt("test.prompt", id="test")

items = ["Lethal Company", "Fatal Company", "My Little Pony", "Circus", "Clown Circus", "Killer Clown", "Not Killer Clown"]
lines = "\n".join([f"{index+1}\t{item}" for index, item in enumerate(items)])
line_count = len(items)

kwargs = {
    "model": "accounts/fireworks/models/llama-v2-7b-chat",
    "messages": prompt.format(lines=lines, line_count=line_count),
    "temperature": 0.0,
}

print(kwargs["messages"].compose())

response = openai.chat.completions.create(**kwargs, stream=True)
# print(response)
for i in response:
    print(i.choices[0].delta.content, end="")
